import http from "@/api";

/**
 * @name 组织架构模块
 */
// 获取组织架构列表
export const getOrganizeList = (params: any) => {
  return http.post<any>('/organizationManagement/userList', params);
};

//获取组织树
export const getOrganicTree = (): Promise<any> => {
  const headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };

  return http.get<any>('/organizationManagement/queryAllCompanyOrgTreeList', {}, { headers });
};

//新增组织
export const addOrganize = (params: any): Promise<any> => {
  return http.post<any>('/organizationManagement/newBranchDepartmentOrg', params);
};

//编辑组织
export const editOrganize = (params: any): Promise<any> => {
  return http.post<any>('/organizationManagement/orgEditing', params);
};

//删除组织（批量删除）
export const deleteOrganize = (params: any): Promise<any> => {
  return http.post<any>('/organizationManagement/orgBatchDeletion', params);
};

//移除组织用户
export const removeOrganizeUser = (params: any): Promise<any> => {
  return http.get<any>(`/organizationManagement/userRemove/${params}`);
};

//根据部门id查看部门下面是否有人
export const viewTheNumberOfPeople = (params: any): Promise<any> => {
  return http.get<any>(`/organizationManagement/whetherHaveInfo/${params}`);
};
